import request from '@/utils/request'

/**
 * 登录
 */
export const login = data => {
  return request({
    url: 'api/exam/login',
    method: 'POST',
    data
  })
}

/**
 * 获取手机验证码
 */
export const getCode = data => {
  // console.log(data);
  return request({
    url: `api/exam/send/${data}`,
    method: 'GET'
  })
}

/**
 * 账号注册
 */
export const register = data => {
  return request({
    url: 'api/exam/register',
    method: 'POST',
    data
  })
}

/**
 * 修改用户信息
 */
export const editInfo = data => {
  return request({
    url: 'api/exam_student',
    method: 'PUT',
    data
  })
}

/**
 * 获取所有试卷
 */
export const examList = () => {
  return request({
    url: 'api/exam_paper/list',
    method: 'GET'
  })
}

/**
 * 获取题目列表
 */

export const questionList = id => {
  return request({
    url: `api/exam_paper/getquestion/${id}`,
    method: 'GET'
  })
}

export const submitExam = data => {
  return request({
    url: 'api/exam_paper/save',
    method: 'POST',
    data
  })
}